package com.dede.state.commons

import android.app.Activity
import android.support.v4.app.Fragment
import com.dede.state.State
import com.dede.state.StateProxy
import com.dede.state.component.StateComponent

/**
 * kotlin扩展
 * @author hsh
 *  2018/1/24 10:17.
 */

fun Activity.register(reloadListener: StateComponent.ReloadListener): StateProxy {
    return State.getDefault().register(this, reloadListener)
}

fun Fragment.register(reloadListener: StateComponent.ReloadListener): StateProxy {
    return State.getDefault().register(this, reloadListener)
}

fun android.app.Fragment.register(reloadListener: StateComponent.ReloadListener): StateProxy {
    return State.getDefault().register(this, reloadListener)
}